package cn.fl.project.service.impl;

import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.preloan.enums.LogBusinessTypeEnum;
import cn.fl.project.condition.PrjQuatPrpsFeeQueryCondition;
import cn.fl.project.dto.PrjQuatPrpsFeeDTO;
import cn.fl.project.service.IPrjQuatPrpsFeeService;
import cn.fl.project.service.IProjectApiService;
import cn.fl.project.transform.PrjQuatPrpsFeeVOTransform;
import cn.fl.project.vo.PrjQuatPrpsFeeVO;
import com.alibaba.fastjson.JSONObject;
import com.lionbridge.log.ext.ExtSlf4jLogger;
import com.lionbridge.log.ext.ExtSlf4jLoggerBuilder;
import com.lionbridge.log.ext.LogTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 项目报价方案-基础费用信息表 客户端服务层接口实现
 * @Description: 业务层方法名称前缀：新增：add* 删除：remove* 修改：modify* 查询对象：select* get* 批量：batch* 查询集合：search*
 */
@Slf4j
@Service
public class PrjQuatPrpsFeeServiceImpl implements IPrjQuatPrpsFeeService {
	private static ExtSlf4jLogger logger = ExtSlf4jLoggerBuilder.create()
			.setLogger(log).setBusinessType(LogBusinessTypeEnum.QUOTATION_SCHEME.getCode())
			.setSubBusinessType(LogBusinessTypeEnum.QUOTATION_SCHEME.getCode())
			.setLogType(LogTypeEnum.BUSINESS).build().setKeywords("PrjQuatPrpsFee");
	/**
	 * TODO 自定义 API 暴露服务
	 */
	@Autowired
	private IProjectApiService projectApiService;

	@Override
	public PrjQuatPrpsFeeVO selectById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return null;
		}
		//TODO 业务逻辑
		PrjQuatPrpsFeeDTO dto = null;//this.自定义ApiService.selectById(id);
		return PrjQuatPrpsFeeVOTransform.toVO(dto);
	}

	@Override
	public Long add(PrjQuatPrpsFeeVO entity) throws BaseException{
		if(null == entity){
			return null;
		}
		//return this.prjQuatPrpsFeeApiService.add(PrjQuatPrpsFeeVOTransform.toDTO(entity));
		//TODO 业务逻辑
		return null;
	}

	@Override
	public boolean removeById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return false;
		}
		//return this.prjQuatPrpsFeeApiService.removeById(id);
		//TODO 业务逻辑
		return false;
	}
	
	/**
     * 删除
     * @param ids
     * @return
     */
    public boolean removeByIds(List<Long> ids)throws BaseException{
		return false;
    }

	@Override
	public boolean modify(PrjQuatPrpsFeeVO entity) throws BaseException{
		if(null == entity){
			return false;
		}
		//return this.prjQuatPrpsFeeApiService.modify(PrjQuatPrpsFeeVOTransform.toDTO(entity));
		//TODO 业务逻辑
		return false;
	}

	@Override
	public Pager searchListPage(Pager page) throws BaseException{
		if(null == page)page = new Pager();
		//return this.prjQuatPrpsFeeApiService.searchListPage(page);
		//TODO 业务逻辑
		return null;
	}

	@Override
	public List<PrjQuatPrpsFeeVO> searchList(PrjQuatPrpsFeeQueryCondition feeQc) {
		if(null != feeQc){
			logger.info("查询报价方案费用项列表feeQc：{}", JSONObject.toJSONString(feeQc));
			return PrjQuatPrpsFeeVOTransform.toVOList(this.projectApiService.searchPrjQuatPrpsFeeList(feeQc));
		}
		return null ;
	}
}
